/*!
 * Copyright (C) 2020 - All Rights Reserved by
 * @author : ZhaoYanbo
 * @email  : zyb920@hotmail.com
 * @created: 2020-10-31
 * @version: 1.0.0.0
 *
 */

#include "CPixmapCache.h"


CPixmapCache *CPixmapCache::getInstance()
{
    static CPixmapCache c;
    return &c;
}

bool CPixmapCache::insert(const QString &key, const QPixmap &pic)
{
    if(m_caches.contains(key))
    {
        return false;
    }
    m_caches.insert(key, pic);
    return true;
}

bool CPixmapCache::find(const QString &key, QPixmap &pic)
{
    if( !m_caches.contains(key) )
    {
        return false;
    }
    pic = m_caches.value(key);
    return true;
}

CPixmapCache::~CPixmapCache()
{
    m_caches.clear();
}
